import com.lml.mapper.ClbumTeacherMapper;
import com.lml.mapper.ClbumsMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

public class test {
    @Test
    public void test01() throws IOException {
        InputStream resourceAsStream = Resources.getResourceAsStream("mybatis.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = build.openSession(true);
        ClbumsMapper mapper = sqlSession.getMapper(ClbumsMapper.class);
        mapper.selectClbumsByGradeAndClbum("大二","软件231").forEach(System.out::println);



    }
    @Test
    public void test02() throws IOException {
        InputStream resourceAsStream = Resources.getResourceAsStream("mybatis.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = build.openSession(true);
        ClbumTeacherMapper mapper = sqlSession.getMapper(ClbumTeacherMapper.class);
        mapper.selectClbumTeacher(1).forEach(System.out::println);






    }

}